//
//  MHBaseViewController.m
//  MHO
//
//  Created by papo on 4/19/14.
//  Copyright (c) 2014 maihoang. All rights reserved.
//

#import "MHBaseViewController.h"
#import "Lib.h"
#import "MHDownloadViewController.h"

@interface MHBaseViewController ()
//@property (

@end

@implementation MHBaseViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navibarView = [MHNavibarView createWithTitle:nil leftButton:kFileBtnHuman rightButton:nil searchButton:YES];
    [self.navibarView setActionSelectorDelegate:self left:@selector(leftButtonPressed:) right:@selector(rightButtonPressed:) search:nil];
    [self.navibarView setRootViewController:self];
    [self.view addSubview:self.navibarView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)leftButtonPressed:(id)button {
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)rightButtonPressed:(id) button {
//    MHDownloadViewController* vc = [[MHDownloadViewController alloc] initWithNibName:@"MHDownloadViewController" bundle:nil];
//    [self.navigationController pushViewController:vc animated:YES];
}

- (IBAction)searchButtonPressed:(id)button {

}

- (BOOL)shouldAutorotate {
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
}

@end
